package com.csx.governance.traffic.adapter.outbound.webclient;

import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.web.reactive.function.client.WebClient;

/**
 * @author cuisongxu
 * @date 2023/4/12 21:36
 */
public class TrafficWebClientCustomizer implements WebClientCustomizer {

    private final TrafficExchangeFilterFunction trafficExchangeFilterFunction;

    public TrafficWebClientCustomizer(TrafficExchangeFilterFunction trafficExchangeFilterFunction) {
        this.trafficExchangeFilterFunction = trafficExchangeFilterFunction;
    }

    @Override
    public void customize(WebClient.Builder webClientBuilder) {
        webClientBuilder.filter(trafficExchangeFilterFunction);
    }
}
